<?php

/**
 * 事件类   具体看 文档 和 b站讲义好吧
 */
namespace app\controller;


use app\listener\TestListen;
use think\facade\Event;

class TestEvent
{
   public function __construct()
   {
       //监听器 动态
/*       Event::listen('TestListen',function ($param){
          echo '监听器1被触发！'.$param;
       });*/
   }
   public function info(){
       echo '登录前准备';
     //Event::trigger('TestListen','ok');

//       Event::listen('TestListen',TestListen::class);

       event('TestListen');
   }
   public function login(){
       echo '登录成功';
       event('UserLogin');
   }
   public function loginout(){
       event('UserLogout');
       echo '退出成功';

   }

}